<?php


namespace app\controller\api;

use app\BaseController;
class Base extends BaseController
{
    /**
     * @param $code
     * @param $message
     * @param $data
     * @notes 接口回执
     * @author: dongdong
     * @date: 2024/12/23 15:42
     */
    public function api_result($code,$message,$data){
        echo json_encode(array('code'=>$code,'message'=>$message,'data'=>$data));
    }

    /**
     * @param $mobileNumber
     * @return bool
     * @notes 验证码
     * @author: dongdong
     * @date: 2024/12/23 15:42
     */
    public function isValidMobileNumber($mobileNumber) {
        return preg_match('/^1\d{10}$/', $mobileNumber) ? true : false;
    }

    /**
     * @return string
     * @notes 随机订单号
     * @author: dongdong
     * @date: 2024/12/23 16:11
     */
    public function order_sn(){
        return date('YmdHis') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
    }
}